package Utility;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * A forum post that contains information about its accessibility, and also its replies.
 * @author Steven Vandervalk
 */
public class ForumMessage implements Serializable {
	private static final long serialVersionUID = 1L;
	private final String postTitle;
	private final ArrayList<String> replies;
	private final String allowedUserList;
	private final String sender;
	private String reply;

	
	ForumMessage(String title, String userList, String sender, String reply) {
		this.postTitle = title;
		this.allowedUserList = userList;
		this.sender = sender;
		this.reply = reply;

		replies = new ArrayList<String>();
		replies.add(reply);
	}

	/**
	 * Add a reply to the forum post.
	 * @param reply
	 */
	public void addReply(String reply) {
		replies.add(reply);
	}
	
	public String getReplies(){
		String s = "";
		for (String reply : replies){
			s += reply + ",";
		}
		
		return s;
	}

	
	public String getMessage() {
		return reply;
	}

	/**
	 * Get the list of users that are allowed to see the current post.
	 * @return Comma-separate string of all allowed users.
	 */
	public String getAllowedUserList() {
		return allowedUserList;
	}

	/**
	 * Get the username of the original poster.
	 * @return Username of OP.
	 */
	String getsender() {
		return sender;
	}

	/**
	 * Get the title of the current forum post.
	 * @return The post title.
	 */
	public String getPostTitle() {
		return postTitle;
	}
	

}
